﻿using System.Collections.Generic;
using System.Data.Entity;

namespace SportMeetingPlanner.Models
{
    public class SampleData : DropCreateDatabaseIfModelChanges<SportMeetingEntities>
    {
        protected override void Seed(SportMeetingEntities context)
        {
            var sports = new List<Sport>
            {
                new Sport() {Name = "Fotbal", MinPlayers = 11},
                new Sport() {Name = "Tenis", MinPlayers = 2}     
            };

            sports.ForEach(a => context.Sports.Add(a));

            var users = new List<User>
            {
                new User() {UserName= "Reka",Email = "rekah@fortech.ro",Password = "reka",TelephoneNumber = "1"},
                new User() {UserName = "Bogdan",Email = "bogdanp@fortech.ro",Password = "wDK+DbuyfOfRZI8cnpRXpQ==",TelephoneNumber = "2"},
                new User() {UserName="Admin", Email="bogdanp@fortech.ro", Password="ISMvKXpXpadDiUoOSoAfww==", TelephoneNumber="4", IsAdmin = true},
                new User() {UserName = "Luci",Email = "butterfly_luciano@yahoo.com",Password = "zPdJ3PeqaSDttPnaySXwoA==",TelephoneNumber = "3"} 
            };

            users.ForEach(a => context.Users.Add(a));

            //var meetings = new List<Meeting>
            //{
            //    new Meeting() { Contact="Luci", Date = new DateTime(2000,1,1), Description = "Fotbal", Location = "Turda", Sport = sports.Single(s=> s.Name=="Fotbal"), Telephone = "3", Title = "Fotbal"}
            //};

            //meetings.ForEach(a => context.Meetings.Add(a));

            //var subscriptions = new List<Subscription>
            //{
            //    new Subscription() { Ball = true, Comment = "party on",UserName="Luci", Meeting = meetings.FirstOrDefault()}
            //};

            //subscriptions.ForEach(a => context.Subscriptions.Add(a)); ;

        }
    }
}